import pandas as pd
from sqlalchemy import create_engine

connect = create_engine('mysql+pymysql://wea313:wea313@119.23.182.180:3306/weather')

item_feature = pd.read_csv('./weather2.txt', encoding='utf-8', sep='\t')


item_feature.columns=['item_id','summary','temperature','humidity','wind_speed','visibility','pressure','wind_bearing']
item_feature[['item_id','summary','wind_bearing']]=item_feature[['item_id','summary','wind_bearing']].astype('int32')
item_feature[['temperature','humidity','wind_speed','visibility','pressure']]=item_feature[['temperature','humidity','wind_speed','visibility','pressure']].astype('float32')
print(item_feature)
pd.io.sql.to_sql(item_feature,'days',connect,if_exists='append',index=False)